using System;
using System.Collections.Generic;
using System.Text;
using CoastToCoast.Game.Units;

namespace CoastToCoast.Game {
    public class City : LandTile {
        private Player _owner;
        public Player Owner {
            get { return _owner; }
            set { _owner = value; }
        }

        private Unit _specialization;
        public Unit Specialization {
            get { return _specialization; }
            set { _specialization = value; }
        }

        private int _currentWork;
        public int CurrentWork {
            get { return _currentWork; }
            set { _currentWork = value; }
        }

        private Unit _currentProduction = new Infantry();
        public Unit CurrentProduction {
            get { return _currentProduction; }
            set { _currentProduction = value; }
        }

        public virtual void OnStartProduction(object sender, EventArgs args) {
            // update production units etc
            _currentWork += 4;
        }

        public virtual void OnEndProduction(object sender, EventArgs args) {
            // Produce a unit always for now
            if (CurrentWork >= _currentProduction.BaseProductionCost) {
                Unit newUnit = _currentProduction.Create(Owner);
                Cell.Board.Move(newUnit, Cell);
                CurrentWork -= _currentProduction.BaseProductionCost; // or should this be 0?
            }
        }
    }
}
